@extends('layouts.admin')
@section('title') @parent 商品分类管理 @stop
@section('page_title')@parent
商品分类管理
@show
@section('breadcrumb')@parent
{{ Breadcrumbs::render('product-category-index') }}
@show
@section('content')
<div class="row">
    <div class="col-xs-12">
        <div class="box">
            <div class="box-header">
                <h3 class="box-title">商品分类</h3>
                <button class="btn btn-default pull-right" type="button" onclick="location.href='{{ route('admin.product_category.add') }}'"><i class="fa fa-plus"></i>添加分类</button>
            </div><!-- /.box-header -->
            <div class="box-body table-responsive">
                <table id="example2" class="table table-bordered table-hover">
                    <thead>
                        <tr>
                            <th>ID</th>
                            <th>名称</th>
                            <th>上级分类</th>
                            <th>排序</th>
                            <th>操作</th>
                        </tr>
                    </thead>
                    <tbody>
                    @foreach($categories as $cat)
                        <tr>
                            <td>{{  $cat->id }}</td>
                            <td>{{ $cat->title }}</td>
                            <td>{{ $cat->parentCategory()->title}}</td>
                            <td>{{ $cat->sort }}</td>
                            <td>
                            <a href="{{ route('admin.product_category.edit',['id'=>$cat->id]) }}" class="btn btn-default">修改</a> 
                            <a href="{{ route('admin.product_category.drop',['id'=>$cat->id]) }}" onclick="return confirm('确定要删除吗？');" class="btn btn-default">删除</a></td>
                        </tr>
                     @endforeach
                    </tbody>
                    <!-- tfoot>
                        <tr>
                            <th>Rendering engine</th>
                            <th>Browser</th>
                            <th>Platform(s)</th>
                            <th>Engine version</th>
                            <th>CSS grade</th>
                        </tr>
                    </tfoot -->
                </table>
            </div><!-- /.box-body -->
            <div class="box-footer clearfix">
		{{ $categories->appends(Input::except('page'))->links() }}
            </div>
        </div><!-- /.box -->
    </div>
</div>
<script type="text/javascript">
$(document).ready(function() {
    $('#example2').dataTable({
        "bPaginate": true,
        "bLengthChange": false,
        "bFilter": false,
        "bSort": true,
        "bInfo": true,
        "bAutoWidth": false
    });
});
</script>
@stop